﻿#light

namespace Twitter.Model

open System

module Utilities =

    let StreamToUTF8String(stream:IO.Stream) : String =
        use reader = new IO.StreamReader(stream)
        reader.ReadToEnd()
        
    let IntOpt(opt:option<int>) : option<string> =
        match opt with | Some i -> Some (i.ToString())
                       | None -> None
                   
    let Int64Opt(opt:option<int64>) : option<string> =
        match opt with | Some i -> Some (i.ToString())
                       | None -> None
                   
    let OptionBuilder(options:list<option<string>>, names:list<string>) : list<string * string> =
        Seq.zip options names 
        |> Seq.filter (fun (opt:option<string>, name) -> opt.IsSome) 
        |> Seq.map (fun (opt:option<string>, name) -> (name, opt.Value))
        |> Seq.to_list 